--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_onozuka_komachi = General:new(extension, "hy_onozuka_komachi", "ten_k", 4, 4, General.Female)
    local fog_ferry = fk.CreateSkill {
        name = "fog_ferry",
    }
    fog_ferry:addEffect(fk.TurnedOver, {
        anim_type = "control",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(fog_ferry.name) and target ~= player and not player.dead and not target.dead and target.faceup == false
        end,
        on_cost = function(self, event, target, player, data)
            local choices = { "fog_ferry_discard", "fog_ferry_draw", "Cancel" }
            if #table.filter(player.player_cards[Player.Hand], function(id)
                    return not player:prohibitDiscard(Fk:getCardById(id))
                end) == 0 and #table.filter(player.player_cards[Player.Equip], function(id)
                    return not player:prohibitDiscard(Fk:getCardById(id))
                end) == 0 then
                table.removeOne(choices, "fog_ferry_discard")
            end
            local result = player.room:askToChoice(player, {
                choices = choices,
                skill_name = fog_ferry.name,
                prompt = "fog_ferry_prompt::" .. target.id
            })
            if result ~= "Cancel" then
                event:setCostData(self, result)
                return true
            end
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            if event:getCostData(self) == "fog_ferry_discard" then
                room:askToDiscard(player, {
                    min_num = 1,
                    max_num = 1,
                    include_equip = true,
                    skill_name = fog_ferry.name,
                    cancelable = false
                })
                if #target:getCardIds({ Player.Hand, Player.Equip }) < 2 then
                    room:throwCard(target:getCardIds({ Player.Hand, Player.Equip }), fog_ferry.name, target, target)
                else
                    local cards = table.connect(table.filter(target.player_cards[Player.Hand], function(id)
                        return not target:prohibitDiscard(Fk:getCardById(id))
                    end), table.filter(target.player_cards[Player.Equip], function(id)
                        return not target:prohibitDiscard(Fk:getCardById(id))
                    end))
                    if #cards > 2 then
                        room:askToDiscard(target, {
                            min_num = 2,
                            max_num = 2,
                            include_equip = true,
                            skill_name = fog_ferry.name,
                            cancelable = false
                        })
                    elseif #cards > 0 then
                        room:throwCard(cards, fog_ferry.name, target, target)
                    end
                end
            else
                if not target.dead then
                    room:drawCards(target, 1, fog_ferry.name)
                end
                if not player.dead then
                    room:drawCards(player, 2, fog_ferry.name)
                end
            end
        end,
    })
    local soul_detach = fk.CreateSkill {
        name = "soul_detach",
    }
    soul_detach:addEffect(fk.TargetSpecified, {
        anim_type = "control",
        can_trigger = function(self, event, target, player, data)
            if player:hasSkill(soul_detach.name) and target == player and player:getMark("soul_detach-turn") == 0 then
                return data.card.is_damage_card and data.firstTarget and #data:getAllTargets() > 0 and
                    not table.every(data:getAllTargets(), function(t)
                        return t:isKongcheng()
                    end)
            end
        end,
        on_cost = function(self, event, target, player, data)
            local targets = table.filter(data:getAllTargets(), function(t)
                return not t:isKongcheng()
            end)
            local results = player.room:askToChoosePlayers(player, {
                targets = targets,
                min_num = 1,
                max_num = 1,
                prompt = "soul_detach_prompt",
                skill_name = soul_detach.name
            })
            if #results > 0 then
                event:setCostData(self, results[1].id)
                return true
            end
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            local skillTarget = room:getPlayerById(event:getCostData(self))
            local cards = room:askToCards(skillTarget, {
                min_num = 1,
                max_num = 1,
                skill_name = soul_detach.name,
                cancelable = false,
                prompt = "soul_detach_show_prompt"
            })
            if type(cards) == "number" then
                cards = { cards }
            end
            local card = Fk:getCardById(cards[1])
            skillTarget:showCards(card)
            local pattern = ".|.|" .. card:getSuitString() .. "|hand"
            local discards = room:askToDiscard(player, {
                min_num = 1,
                max_num = 1,
                skill_name = soul_detach.name,
                pattern = pattern,
                prompt = "soul_detach_discard_prompt::" .. skillTarget.id .. ":" .. card:getSuitString(true)
            })
            if #discards > 0 then
                skillTarget:turnOver()
                room:setPlayerMark(player, "soul_detach-turn", 1)
            end
        end,
    })
    local inferno = fk.CreateSkill {
        name = "inferno",
    }
    inferno:addEffect(fk.TargetSpecifying, {
        anim_type = "switch",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(inferno.name) and data.card.trueName == "slash" and target == player and player:getMark("inferno_TargetSpecifying-turn") == 0
        end,
        on_cost = function(self, event, target, player, data)
            local targets = HY.AskForAddTarget(player, 1, false, false, "inferno_prompt:::" .. data.card:toLogString(), inferno.name, data)
            if #targets > 0 then
                player.room:setPlayerMark(player, "inferno_TargetSpecifying-turn", 1)
                event:setCostData(self, targets[1].id)
                return true
            end
        end,
        on_use = function(self, event, target, player, data)
            HY.ChangeTarget(data, player.room:getPlayerById(event:getCostData(self)))
        end,
    })
    inferno:addEffect(fk.TargetConfirming, {
        anim_type = "switch",
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(inferno.name) and data.card.trueName == "slash" and target == player and player:getMark("inferno_TargetConfirming-turn") == 0
        end,
        on_cost = function(self, event, target, player, data)
            local targets = HY.AskForAddTarget(player, 1, false, false, "inferno_prompt:::" .. data.card:toLogString(), inferno.name, data)
            if #targets > 0 then
                player.room:setPlayerMark(player, "inferno_TargetConfirming-turn", 1)
                event:setCostData(self, targets[1].id)
                return true
            end
        end,
        on_use = function(self, event, target, player, data)
            HY.ChangeTarget(data, player.room:getPlayerById(event:getCostData(self)))
        end,
    })
    extension:loadSkillSkels { fog_ferry, soul_detach, inferno }
    hy_onozuka_komachi:addSkill("fog_ferry")
    hy_onozuka_komachi:addSkill("soul_detach")
    hy_onozuka_komachi:addSkill("inferno")
    Fk:loadTranslationTable {
        ["hy_onozuka_komachi"] = "小野塚小町",
        ["#hy_onozuka_komachi"] = "冥河往返",
        ["illustrator:hy_onozuka_komachi"] = "姫乃ちぃ。",
        ["designer:hy_onozuka_komachi"] = "黑曜人形",
        ["cv:hy_onozuka_komachi"] = "",

        ["fog_ferry"] = "雾渡",
        [":fog_ferry"] = "其他角色翻至背面后，你可以选择一项：1.弃一张牌，然后其依次弃置两张牌；2.令其摸一张牌，然后你摸两张牌。",
        ["fog_ferry_prompt"] = "雾渡：选择与%dest执行的一项",
        ["fog_ferry_discard"] = "弃牌",
        ["fog_ferry_draw"] = "摸牌",

        ["soul_detach"] = "脱魂",
        [":soul_detach"] = "在你使用伤害类卡牌指定目标后，你可以令其中一个目标展示一张手牌。然后你可以弃置一张与展示牌花色相同的手牌并令其翻面，然后“脱魂”本回合失效。 ",
        ["soul_detach_prompt"] = "脱魂：你可以展示其中一个目标一张手牌",
        ["soul_detach_show_prompt"] = "脱魂：展示一张手牌",
        ["soul_detach_discard_prompt"] = "脱魂：你可以弃置一张%arg手牌并令%dest翻面",

        ["inferno"] = "无间",
        [":inferno"] = "每回合各限一次，你使用【杀】指定目标时或成为【杀】的目标时可以为此【杀】增加一个目标。",
        ["inferno_prompt"] = "无间：你可以为%arg增加一个目标",
    }
end
